{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">

                        <div class="x_panel">
                            <div class="x_title">
                                <h2>奖品管理</h2>
                                <!--<a style="float: right" href="{:url('create')}"-->
                                   <!--class="btn btn-success btn-sm">创建奖品</a>-->
                                <div class="clearfix"></div>
                            </div>
                            <div class="title_left">
                                <form name="form1"  method="get" action="">
                                    <div class="input-group col-md-2 col-sm-3 col-xs-4" style="float: left;margin-left:8px;">
                                        <select name="status" class="select2_single" style="width: 100%;"
                                                tabindex="-1">
                                            <option value="0">- 请选择兑奖状态 -</option>
                                            <option value="1" {eq name=':input("status")' value='1' }selected{/eq}>未兑奖</option>
                                            <option value="2" {eq name=':input("status")' value='2' }selected{/eq}>已兑奖</option>
                                        </select>
                                    </div>
                                    <div class="col-md-2 col-sm-3 col-xs-12 form-group pull-left top_search">

                                        <div class="input-group">
                                            <input type="text" class="form-control" name="title"
                                                   placeholder="输入搜索内容..." value="{:input('title')}">
                                        </div>

                                    </div>
                                    <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索</button>
                                </form>
                            </div>
                            <div class="x_content">
                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                            <!--<input type="checkbox" class="checkall"-->
                                            <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->
                                            <th width="30">ID</th>
                                            <th width="">中奖奖品名称</th>
                                            <th width="">中奖人 姓名/手机号/身份证号</th>
                                            <th width="">中奖时间</th>
                                            <th width="">兑奖状态</th>
                                            <th width="">兑奖时间</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="data"}
                                        <tr><td colspan="5"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        {volist name="data" id="item"}
                                        <tr >
                                            <td>{$item.id}</td>
                                            <td>{$item.draw_title}</td>
                                            <td>{$item.name}/{$item.phone}/{$item.id_number}</td>
                                            <td>{$item.create_time}</td>
                                            <td>{switch name="item.status"}
                                                 {case 1}未兑奖{/case}
                                                {case 2}已兑奖{/case}
                                                {default}无
                                                {/switch}
                                            </td>
                                            <td>{$item.status_time}</td>
                                            <!--<td>-->
                                            <!--<input type="checkbox" id="checkbox4_{$item.id}" class="chk_3"-->
                                            <!--value="{$item.status}" {eq name="item['status']" value="1"}checked{/eq} />-->
                                            <!--<label style="margin-left: 30px;margin-top: 5px;"-->
                                            <!--onclick="CheckInfo('{:url(\'status\',[\'id\' => $item[\'id\']])}')"-->
                                            <!--for="checkbox4_{$item.id}"></label>-->
                                            <!--</td>-->

                                            <td class="operate" >
                                                <div>{switch name="item.status"}
                                                    {case 1}<a href="{:url('update', ['id' => $item['id']])}"
                                                               class="label label-primary">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;兑 奖
                                                    </a>{/case}
                                                    {case 2}<a href="{:url('update', ['id' => $item['id']])}"
                                                               class="label label-success">
                                                        <span class="fa fa-pencil"></span>&nbsp;&nbsp;查 看
                                                    </a>{/case}
                                                    {default}无
                                                    {/switch}</div>

                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                    <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                <button type="button" class="btn btn-info" style="margin-top: 20px;" onclick="dc({:input('coupon_id')})">中奖记录导出</button>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script type="text/javascript">
    // list
    $('[name="status"]').change(function(){
        //form.submit();
        //$('form').submit();
    });
    $(document).ready(function () {
        // select2
        $(".select2_single").select2({
            placeholder: "请选择分类",
            allowClear: true
        });
    });
</script>
<script>
    function dc(id){

        var title = "{:input('title')}";
        var status = "{:input('status')}";
        window.location.href = "{:url('daochu')}?status="+status+'&title='+title;
    }
</script>